package XComponent.show.core
{
	/**创建一个可以点击的透明组建地板
	 * 
	 */	
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.Sprite;
	
	public class XUIComonent	extends Sprite
	{
		private const BACKGROUNDCOLOR_DEFAULT : int = 0xFFFF00;
		
		private var m_width : Number;
		private var m_height : Number;
		
		private var m_layer : Bitmap;
		
		public function XUIComonent(width : int = 50,height : int = 50)
		{
			var bitD:BitmapData = new BitmapData(1,1,true,0x00000000);
			
			m_layer = new Bitmap(bitD);
			
			this.addChild(m_layer);
			
			setSize(width,height);
		}
		
		/**
		 *设置宽高 
		 * @param width
		 * @param height
		 * 
		 */		
		public function setSize(width:Number,height:Number) : void
		{
			m_layer.width = width;
			m_layer.height = height;
			
			m_width	= 	width;
			m_height = 	height;
		}
		
		/**
		 *显示默认背景 
		 * @param color
		 * 
		 */		
		public function drawDefaultBackground(color : int= -1) : void
		{
			this.graphics.clear();
			
			if(color<0)
			{
				this.graphics.beginFill(BACKGROUNDCOLOR_DEFAULT);
			}
			else
			{
				this.graphics.beginFill(color);
			}
			
			this.graphics.drawRect(0,0,width,height);
			
			this.graphics.endFill();
		}
		
		override public function set width(_width : Number) : void
		{
			m_layer.width = _width;
			super.width = 	_width;
		}
		
		override public function get width() : Number
		{
			return m_width;
		}
		
		override public function set height(_height : Number) : void
		{
			m_layer.height =_height;
			super.height = _height;
		}
		
		override public function get height():Number
		{
			return m_height;
		}
		
		public function setStyle(style:String,value:Object):void
		{
			
		}
	}
}